import * as shoppingCartApi from '@/api/shopping-cart.js';

export default {
  namespaced: true,
  state() {
    return {
      shoppingCartList: [],
    };
  },
  mutations: {
    SET_SHOPPING_CART_LIST(state, newValue) {
      state.shoppingCartList = newValue;
    },
  },
  actions: {
    async updateShoppingCartList({ commit }) {
      const res = await shoppingCartApi.getShoppingCartList();
      commit('SET_SHOPPING_CART_LIST', res);
    },
  },
};
